import { createRouter, createWebHashHistory } from "vue-router";

const defRoutes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    component: () => import("@/views/login/login.vue"),
  },
];
export const routes = [
  {
    path: "/homeCenter",
    name: "home",
    meta: { title: "系统首页", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/homeCenter",
        component: () => import("@/views/home/homeCenter.vue"),
        name: "home:homeCenter",
        meta: { title: "数据统计", icon: "icon-shouyediqiu" },
      },
    ],
  },
  {
    path: "/account/list",
    name: "account",
    meta: { title: "账号管理", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/account/list",
        component: () => import("@/views/account/list.vue"),
        name: "account:list",
        meta: { title: "账号列表", icon: "icon-shouyediqiu" },
      },
    ],
  },
  {
    path: "/product/list",
    name: "product",
    meta: { title: "商品管理", icon: "icon-shangpin" },
    children: [
      {
        path: "/product/list",
        component: () => import("@/views/product/list.vue"),
        name: "product:list",
        meta: { title: "商品列表", icon: "icon-shangpin" },
      },
    ],
  },
  {
    path: "/test",
    name: "test",
    meta: { title: "测试", icon: "icon-shouyediqiu" },
    children: [
      {
        path: "/test",
        component: () => import("@/views/test/index.vue"),
        name: "test:index",
        meta: { title: "测试", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/checkbox",
        component: () => import("@/views/test/checkboxDemo.vue"),
        name: "test:checkbox",
        meta: { title: "多选框演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/switch",
        component: () => import("@/views/test/switchDemo.vue"),
        name: "test:switch",
        meta: { title: "开关演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/form",
        component: () => import("@/views/test/formDemo.vue"),
        name: "test:form",
        meta: { title: "表单组件演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/time",
        component: () => import("@/views/test/timeDemo.vue"),
        name: "test:time",
        meta: { title: "时间选择器演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/date",
        component: () => import("@/views/test/dateDemo.vue"),
        name: "test:date",
        meta: { title: "日期选择器演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/treeselect",
        component: () => import("@/views/test/treeSelectDemo.vue"),
        name: "test:treeselect",
        meta: { title: "树状下拉多选演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/treeselectsingle",
        component: () => import("@/views/test/treeSelectSingleDemo.vue"),
        name: "test:treeselectsingle",
        meta: { title: "树状下拉单选演示", icon: "icon-shouyediqiu" },
      },
      {
        path: "/test/dropdown",
        component: () => import("@/views/test/dropdownDemo.vue"),
        name: "test:dropdown",
        meta: { title: "下拉选择演示", icon: "icon-shouyediqiu" },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: defRoutes.concat(routes),
});

export default router;
